<div id="files-browser-contents">
  <h4><?php echo $this->lang->line('label.files.manage') ?></h4>
  <table border="0" class="table-list">
    <thead>
      <tr>
        <th><?php echo $this->lang->line('label.file.name') ?></th>
        <th width="200"></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>            
          <a class="folder-hash" data-path="<?php echo $this->lang->line('label.folder.parent') ?>" 
             title="<?php echo $this->lang->line('label.folder.parent') ?>" 
             href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/index?path=' . dirname($dir)) ?>">
            <img src="<?php echo base_url().APPPATH . 'themes/admin/img/icons/folder.png' ?>" 
                 alt="folder" title="folder"/> ..</a>
        </td>
        <td class="actions">
          <a class="button add modal cboxElement" href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/create_folder?path=' . $dir) ?>">
            <?php echo $this->lang->line('btn.create_folder') ?>
          </a>
          <a class="button upload modal cboxElement" id="upload_file"
             href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/upload?path=' . $dir) ?>">
               <?php echo $this->lang->line('btn.upload') ?>
          </a>
        </td>
      </tr>
      <?php foreach ($folders as $obj) { ?>
        <tr>
          <td>              
            <a class="folder-hash" data-path="<?php echo $obj ?>" title="<?php echo $obj ?>" 
               href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/index?path=' . $dir . '/' . $obj) ?>">
              <img src="<?php echo base_url().APPPATH . 'themes/admin/img/icons/folder.png' ?>" 
                   alt="folder" title="folder"/> <?php echo $obj ?></a></td>
          <td class="actions">
            <a class="button delete confirm" href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/delete_folder?path=' . $dir . '/' . $obj) ?>">
              <?php echo $this->lang->line('btn.delete') ?>
            </a>
          </td>
        </tr>
      <?php } ?>
      <?php foreach ($files as $obj) { ?>
        <tr>
          <td>
            <a class="folder-hash preview modal cboxElement" data-path="<?php echo $obj ?>" title="<?php echo $obj ?>"
               href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/view_file?path=' . $dir . '/' . $obj) ?>">
              <img src="<?php echo base_url().APPPATH . 'themes/admin/img/icons/file.png' ?>" 
                   alt="folder" title="folder"/> <?php echo $obj ?></a>
          </td>
          <td class="actions">
            <?php
            $pathinfo = pathinfo($dir . '/' . $obj);
            $pathinfo['extension'] = strtolower($pathinfo['extension']);
            if ($pathinfo['extension'] == 'js' || $pathinfo['extension'] == 'css' ||
                    $pathinfo['extension'] == 'xml' || $pathinfo['extension'] == 'txt') {
              ?>
              <a class="button edit modal cboxElement" 
                 href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/edit_file?path=' . $dir . '/' . $obj) ?>">
                   <?php echo $this->lang->line('btn.edit') ?>
              </a>
            <?php } ?>
            <a class="button download_file" 
               href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/download?path=' . $dir . '/' . $obj) ?>">
                 <?php echo $this->lang->line('btn.download') ?>
            </a>
            <a class="button delete confirm" href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/delete_folder?path=' . $dir . '/' . $obj) ?>">
              <?php echo $this->lang->line('btn.delete') ?>
            </a>
          </td>
        </tr>
      <?php } ?>
    </tbody>
  </table>
</div>